/*
 * @Author: lei
 * @Description: using 的三种使用方式示例
 * @FilePath: /code/test_using.cc
 */
// g++ -o test_using test_using.cc -std=c++11
#include <iostream>
// using namespace std; 导入整个命名空间
using std::cout;  // 导入某个命名空间中的单个函数或变量
using std::endl;
typedef int INT;
using INT = int;  // 为类型取别名
namespace lei {
int var = 20;
void func() { cout << "func() in lei" << endl; }
}  // namespace lei
struct Base {
  void func(int a) { cout << "Base::func(int)" << endl; }
  void func() { cout << "Base::func()" << endl; }

 protected:
  int a = 10;
};
struct Derived : Base {
  using Base::a;
  using Base::func;
  void func(int a) { cout << "Derived::func(int)" << endl; }
};

void test1() {
  Base base;
  Derived d1;
  base.func();
  base.func(3);
  d1.func();
  d1.func(3);
  cout << d1.a << endl;
  lei::func();
}

int main() {
  test1();
  return 0;
}